package top.toptimus.dto.kashiyamaMaterial;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import top.toptimus.util.DateTimeUtil;

import java.util.Map;

/**
 * 面料信息
 */
@AllArgsConstructor
@NoArgsConstructor
@Data
public class KashiyamaMateriaDtaillDTO {
    private String id;
    private String fabric;
    private String quantity;
    private String inout_type;
    private String create_date;

    public KashiyamaMateriaDtaillDTO(Map<String, Object> stringObjectMap) {
        try {
            this.id = stringObjectMap.containsKey("id") ? stringObjectMap.get("id").toString() : "";
        } catch (Exception ignored) {
        }
        try {
            this.fabric = stringObjectMap.containsKey("fabric") ? stringObjectMap.get("fabric").toString() : "";
        } catch (Exception ignored) {
        }
        try {
            this.quantity = stringObjectMap.containsKey("quantity") ? stringObjectMap.get("quantity").toString() : "";
        } catch (Exception ignored) {
        }
        try {
            this.inout_type = stringObjectMap.containsKey("inout_type") ? stringObjectMap.get("inout_type").toString() : "";
        } catch (Exception ignored) {
        }
        try {
            this.create_date =
                    DateTimeUtil.convertToDate(
                            DateTimeUtil.strToDateLong(
                                    stringObjectMap.containsKey("create_date") ? stringObjectMap.get("create_date").toString() : ""
                            )
                    );

        } catch (Exception ignored) {
        }
    }


}
